home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1997 July / macformat52.iso / mac / Shareware Plus / Developers / YAAF v1.0 alpha 1 / Headers / Core / XConfig.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-04-24  |  4.9 KB  |  187 lines

  1. /*    XConfig.h
  2.  *
  3.  *        Configuration information
  4.  */
  5.  
  6. /*  YAAF - Yet another application framework
  7.  *  Copyright (C) 1997 William Edward Woody and In Phase Consulting
  8.  *  
  9.  *  This library is free software; you can redistribute it
  10.  *  and/or modify it under the terms of the GNU Library
  11.  *  General Public License as published by the Free Software
  12.  *  Foundation; either version 2 of the License, or any
  13.  *  later version.
  14.  *  
  15.  *  This library is distributed in the hope that it will be
  16.  *  useful, but WITHOUT ANY WARRANTY; without even the implied
  17.  *  warranty of MERCHANTABIILITY or FITNESS FOR A PARTICULAR
  18.  *  PURPOSE. See the GNU Library General Public License for
  19.  *  more details.
  20.  *  
  21.  *  You should have received a copy of the GNU Library General
  22.  *  Public License along with this library; if not, write to the
  23.  *  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  24.  *  Boston, MA 02111-1307, USA.
  25.  *  
  26.  *  To contact the author, either e-mail me at
  27.  *  woody@alumni.caltech.edu, or write to us at
  28.  *  
  29.  *          William Edward Woody
  30.  *          In Phase Consulting
  31.  *          1545 Ard Eevin Avenue
  32.  *          Glendale, CA 91202
  33.  */
  34.  
  35. #ifndef __XCONFIG_H__
  36. #define __XCONFIG_H__
  37.  
  38. /************************************************************************/
  39. /*                                                                        */
  40. /*    OS Selection                                                         */
  41. /*                                                                        */
  42. /************************************************************************/
  43.  
  44. /*
  45.  *    This configures one of three fields, depending on the compiler-specific
  46.  *    flags that are set. These options are:
  47.  * 
  48.  *        OPT_MACOS            -- 1 if this is the Macintosh version, 0 otherwise
  49.  *        OPT_WINOS            -- 1 if this is the Win32 version, 0 otherwise
  50.  *        OPT_XWIN            -- 1 if this is the X Windows version, 0 otherwise
  51.  */
  52.  
  53. #ifdef __MWERKS__                /* Metrowerks compiler */
  54.  
  55.     #ifdef macintosh
  56.         #define OPT_MACOS    1
  57.         #define OPT_WINOS    0
  58.         #define OPT_XWIN    0
  59.     #endif
  60.     
  61.     #ifdef __INTEL__
  62.         #define OPT_MACOS    0
  63.         #define OPT_WINOS    1
  64.         #define OPT_XWIN    0
  65.     #endif
  66.  
  67. #endif /* __MWERKS__ */
  68.  
  69. /************************************************************************/
  70. /*                                                                        */
  71. /*    Floating window support (Mac only)                                    */
  72. /*                                                                        */
  73. /************************************************************************/
  74.  
  75. #if OPT_MACOS == 1
  76.  
  77. #define OPT_FLOATWINDOW        0            /* 1 == floating window support    */
  78.  
  79. #endif
  80.  
  81. /************************************************************************/
  82. /*                                                                        */
  83. /*    Native Byte Order                                                    */
  84. /*                                                                        */
  85. /************************************************************************/
  86.  
  87. /*
  88.  *    OPT_NATIVEORDER
  89.  *
  90.  *        This is set to 1 if the native order for word and long word
  91.  *    integers are in network native order (680x0 order) or not.
  92.  *
  93.  *        My resource files are written in network order, and so I need
  94.  *    to know to make sure the data is read correctly
  95.  */
  96.  
  97. #if OPT_MACOS == 1
  98. #define OPT_NATIVEORDER        1            /* Native network byte order    */
  99. #elif OPT_WINOS == 1
  100. #define OPT_NATIVEORDER        0            /* Not native order                */
  101. #endif
  102.  
  103. /************************************************************************/
  104. /*                                                                        */
  105. /*    Boolean Support                                                        */
  106. /*                                                                        */
  107. /************************************************************************/
  108.  
  109. #if OPT_MACOS == 0
  110.  
  111. #define bool    unsigned char            /* Quick and dirty bool support    */
  112. #define true    1                        /* For bool impared compilers    */
  113. #define false    0
  114.  
  115. #endif
  116.  
  117. /************************************************************************/
  118. /*                                                                        */
  119. /*    Native structure support                                            */
  120. /*                                                                        */
  121. /************************************************************************/
  122.  
  123. #if OPT_WINOS == 1
  124.  
  125. /*
  126.  *    Common structure declarations
  127.  */
  128.  
  129. typedef struct tagRECT Rect;
  130. typedef struct Point {
  131.     long h;
  132.     long v;
  133. } Point;
  134.  
  135. /*
  136.  *    Support utilities [mimic stuff I use a lot on Windows]. Note that
  137.  *    this is only available in C++; this is to avoid name conflicts
  138.  *    with existing WindowsOS calls.
  139.  *
  140.  *    (And why bother when Windows already has a version? So I don't have
  141.  *    to bracket these in my code with a #if OPT_WINOS == 1/#endif pair
  142.  *    every damned time I want to manipulate a rectangle.
  143.  */
  144.  
  145. #ifdef __cplusplus
  146.  
  147. extern bool EmptyRect(Rect *);
  148. extern bool PtInRect(Point,Rect *);
  149. extern bool SectRect(Rect *, Rect *, Rect *);
  150.  
  151. #endif /* __cplusplus */
  152.  
  153. /*
  154.  *    Globals
  155.  */
  156.  
  157. #ifdef __cplusplus
  158. extern "C" {
  159. #endif
  160.  
  161. extern HINSTANCE _GInstance;
  162. extern HINSTANCE _GPrevInstance;
  163. extern LPSTR     _GArgString;
  164. extern int         _GArgShow;
  165.  
  166. #ifdef __cplusplus
  167. }
  168. #endif
  169.  
  170. #endif /* OPT_WINOS */
  171.  
  172. /************************************************************************/
  173. /*                                                                        */
  174. /*    Verify something is set                                                */
  175. /*                                                                        */
  176. /************************************************************************/
  177.  
  178. #if (OPT_MACOS != 1) && (OPT_WINOS != 1) && (OPT_XWIN != 1)
  179.     #error Must define OPT_MACOS, OPT_WINOS, or OPT_XWIN in XConfig.h
  180. #endif
  181.  
  182. #if !defined(OPT_NATIVEORDER)
  183.     #error Must define OPT_NATIVEORDER
  184. #endif
  185.  
  186. #endif /* __XCONFIG_H__ */
  187.